# arc operations.
set.arc(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)
drop.arc(x, from, to, debug = FALSE)
reverse.arc(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)# edge (i.e. undirected arc) operations
set.edge(x, from, to, check.cycles = TRUE, check.illegal = TRUE, debug = FALSE)
drop.edge(x, from, to, debug = FALSE)
bn
.TRUE
the graph is tested for
acyclicity; otherwise the graph is returned anyway.TRUE
arcs that break the
parametric assumptions of x
, such as those from continuous to
discrete nodes in conditional Gaussian networks, cause an error.TRUE
a lot of debugging output is
printed; otherwise the function is completely silent.x
.set.arc
function operates in the following way:
from
and to
, the arc
from
\(\rightarrow\) to
is added.
from
and to
, its
direction is set to from
\(\rightarrow\) to
.
to
\(\rightarrow\) from
is present,
it is reversed.
from
\(\rightarrow\) to
is present, no
action is taken.
drop.arc
function operates in the following way:
from
and to
, no action is
taken.
from
and
to
, it is dropped regardless of its direction.
reverse.arc
function operates in the following way:
from
and to
, it returns an
error.
from
and to
, it
returns an error.
to
\(\rightarrow\) from
is present, it
is reversed.
from
\(\rightarrow\) to
is present, it
is reversed.
set.edge
function operates in the following way:
from
and to
, the undirected
arc from
- to
is added.
from
and to
, no
action is taken.
from
\(\rightarrow\) to
or the
arc to
\(\rightarrow\) from
are present, they are
replaced with the undirected arc from
- to
.
drop.edge
function operates in the following way:
from
and to
, no
action is taken.
from
and to
, it
is removed.
from
and to
, no
action is taken.
data(learning.test)
res = gs(learning.test)
## use debug = TRUE to get more information.
set.arc(res, "A", "B")
drop.arc(res, "A", "B")
drop.edge(res, "A", "B")
reverse.arc(res, "A", "D")
Run the code above in your browser using DataLab